<!--河南星辰软件科技有限公司
@copyright Copyright (c) 2010~2022 All rights reserved.
-->
<template>
  <div class='app-container'>
    <el-form ref="form" :model="ts_folders" :rules="rules" label-width="100px" id="mvcfm">
      <div class="form-unit">
        <span class="mvc-title-left"> 文件夹 </span>
      </div>
      <el-table :data="pageList" v-loading="loading" row-key="folder_id" :tree-props="{children: 'children', hasChildren: 'hasChildren'}" default-expand-all class0="folder">
        <el-table-column label="操作" align="center" width='100' type=''>
          <template slot-scope="scope">
            <el-dropdown trigger="click">
              <span class="el-dropdown-link">操作<i class="el-icon-arrow-down el-icon--right"></i></span>
              <el-dropdown-menu slot="dropdown">
                <el-dropdown-item>
                </el-dropdown-item>
                <el-dropdown-item>
                </el-dropdown-item>
                <el-dropdown-item>
                  <el-link @click="d_folders('&CMID4='+scope.row.folder_id+'')">删除</el-link>
                </el-dropdown-item>
              </el-dropdown-menu>
            </el-dropdown>
          </template>
        </el-table-column>
        <el-table-column label="文件夹" prop="subject">
        </el-table-column>
      </el-table>
    </el-form>
  </div>
</template>
<script>
  import request from '@/utils/request'
  export default {
    name: 'CompanyFileNext',
    components: {},
    props: ['popparams'],
    data() {
      return {
        vueparams: this.getVUEParams(""),
        ts_folders: [],
        s_tree_menu: [],
        loading: true,
        pageList: [],
        pageSize: 10,
        total: null,
        rules: {}
      }
    },
    created() {
      this.getData();
      this.getPage(1);
    },
    updated() {},
    mounted() {},
    methods: {
      getData() {
        request({
          method: 'get',
          url: '/xcapi/VUEAction/mes/systemadmin/CompanyFileNext/companyFileNext?' + this.vueparams,
        }).then(data => {
          for (var k in data) {
            if (Array.isArray(data[k])) {
              this[k] = data[k];
            } else {
              $.extend(this[k], data[k]);
            }
          }
        })
      },
      pub_file(_params) {
        request({
          method: 'post',
          url: '/xcapi/VUEAction/mes/systemadmin/CompanyFileNext/pub_file?' + _params + this.vueparams,
          data: this.postData()
        }).then(data => {
          this.$router.replace("/redirect" + this.$route.fullPath);
          this.msgSuccess(data.msg);
        })
      },
      getPage(page) {
        this.loading = true;
        request({
          method: 'get',
          url: '/xcapi/VUEAction/mes/systemadmin/CompanyFileNext/s_folder?' + this.vueparams,
          params: {
            pageNo: page
          }
        }).then(data => {
          this.loading = false;
          this.pageList = this.loadTreeTable(data.rows, "folder_id", "parent_id");
          this.total = data.total;
        })
      },
      handleOutline(data) {
        request({
          method: 'get',
          url: '/xcapi/VUEAction/mes/systemadmin/CompanyFileNext/s_tree_menu?' + this.vueparams,
        }).then(data => {
          this.s_tree_menu = data.s_tree_menu;
          this.s_tree_menu = this.s_tree_menu.reverse();
        })
      },
    },
  }
</script>
